package com.doudou.collection.infrastructure.common.ex;

import com.doudou.collection.infrastructure.common.web.StatusCode;
import lombok.Getter;

/**
 * @ClassName ServiceException<br>
 * @Description 业务逻辑层异常<br>
 * @Author 李浩文<br>
 * @Date 2023/6/14 21:21<br>
 * @Version 1.0<br>
 */
public class ServiceException extends RuntimeException {

    @Getter
    private Integer serviceCode;

    public ServiceException(Integer serviceCode, String message) {
        super(message);
        this.serviceCode = serviceCode;
    }

    public ServiceException(StatusCode statusCode) {
        this(statusCode.getCode(), statusCode.getMessage());
    }
}
